home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / apport / kernel_crashdump < prev    next >
Encoding:
Text File  |  2009-09-25  |  1.1 KB  |  38 lines

  1. #!/usr/bin/python
  2. #
  3. # Collect information about a kernel oops.
  4. #
  5. # Copyright (c) 2007 Canonical Ltd.
  6. # Author: Martin Pitt <martin.pitt@ubuntu.com>
  7. #
  8. # This program is free software; you can redistribute it and/or modify it
  9. # under the terms of the GNU General Public License as published by the
  10. # Free Software Foundation; either version 2 of the License, or (at your
  11. # option) any later version.  See http://www.gnu.org/copyleft/gpl.html for
  12. # the full text of the license.
  13.  
  14. import os, sys
  15. import apport, apport.fileutils
  16.  
  17. vmcore_path = os.path.join(apport.fileutils.report_dir, 'vmcore')
  18.  
  19. if not os.path.exists(vmcore_path):
  20.     sys.exit(0)
  21.  
  22. pr = apport.Report('KernelCrash')
  23. pr['Package'] = 'linux-image-' + os.uname()[2]
  24. pr['SourcePackage'] = 'linux'
  25.  
  26. pr['VmCore'] = (vmcore_path,)
  27. if os.path.exists(vmcore_path + '.log'):
  28.     pr['VmCoreLog'] = (vmcore_path + '.log',)
  29.  
  30. # write report
  31. pr.write(open(apport.fileutils.make_report_path(pr), 'w'))
  32.  
  33. # clean up the core files
  34. os.unlink(vmcore_path)
  35. if os.path.exists(vmcore_path + '.log'):
  36.     os.unlink(vmcore_path + '.log')
  37.  
  38.